<template>
  <div v-if="!!lists.length">
    <div
      style="margin-bottom: 30px"
      v-for="(list, index) in lists"
      :key="index"
    >
      <div class="name">{{ index + 1 }}、{{ list.name }}</div>
      <div class="pre-box" :class="{ bg: !list.url }">
        <div class="ifnormal">
          <component :is="list.componentName" :list="list"> </component>
        </div>
      </div>
    </div>
  </div>
  <div class="ifnull" v-else>暂无模板</div>
</template>

<script>
import LargeScreen from '../thumbnailComponents/LargeScreen'
import modules from '../thumbnailComponents/exportModel.js'

export default {
  components: {
    LargeScreen,
    ...modules
  },
  props: {
    lists: {
      type: Array,
      default: () => []
    }
  },
}
</script>

<style lang="less" scoped>
.name {
  margin-bottom: 16px;
}
.pre-box {
  position: relative;
}
.pre-box::before {
  content: '';
  display: block;
  padding-top: 56.25%;
}
.pre-box,
.ifnull {
  border: 1px dashed #d9d9d9;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  width: 100%; /* 或任何具体值 */
  aspect-ratio: 1920 / 1080; /* 宽度与高度的比例为 4:3 */
}
.ifnormal {
  width: 100%;
  height: 100%;
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  right: 0;
}
.bg {
  background: #f5f8fb;
}
.ifnull {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
}
</style>
